package cn.mavor.day0903;

import java.util.Scanner;

public class primenum{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        System.out.println("输入一个整数");
        int num = sc.nextInt();
        sc.close();

        System.out.println(num + "=" + decompose(num));
    }


    private static String decompose(int num){
        StringBuilder factor = new StringBuilder();

        while (num%2 == 0){
            factor.append("*2");
            num/=2;
        }
        for(int i = 3; i<Math.sqrt(num); i += 2){
            while(num % i == 0){
                factor.append("*"+i);
                num /= i;
            }
        }
        if(num > 1){
            factor.append("*"+num);
        }
        return factor.toString().startsWith("*") ? factor.substring(1) : factor.toString();
    }
}
